#!/bin/sh

# Add slicer script for octoprint
echo "#!/bin/sh" > /usr/share/cura/cura.sh
echo "PYTHONPATH=. python2 -m Cura.cura \$@" >> /usr/share/cura/cura.sh
chown octo:octo /usr/share/cura/cura.sh
chmod +x /usr/share/cura/cura.sh

# Make upload folder writable
chown octo:octo /usr/share/models
chmod 777 /usr/share/models

# MAke the cura config folder writable
mkdir -p /etc/cura
chmod 777 /etc/cura

# Copy default cura configs to /etc/cura
cp /usr/share/cura/resources/machine_profiles/*.ini /etc/cura 
# Link if no link exists 
if [ ! -f /etc/cura/printer.ini ] ; then
	cd /etc/cura
	ln -s Mendel.ini printer.ini
fi



